/**
 * New node file
 */

module.exports = {
	
	jsticket : function(req, res){
		
		WechatService.getJsApiTicket(function(err, result){
			var config = sails.config.connections.weixinServer
			if(!err){
				return res.send({
					success : true,
					ticket : result.ticket,
					appId : config.corpid
				});
			}else{
				sails.log.error(err);
				return res.send({
					success : false,
					error : err
				});
			}
		})
		
	}
		
}
